#include "test.h"
#include <string.h>
#include <unistd.h>
#define STYLE '#'
#define M 101 
void func()
{
  char buffer[M];
  memset(buffer,0,sizeof(buffer));
  const char *lable = "|/-\\";
  int len = strlen(lable);
  int cut = 0;
  while(cut<=100)
  {
    printf("[%-100s][%d%%][%c]\r",buffer,cut,lable[cut%len]);
    fflush(stdout);
    buffer[cut] = STYLE;
    cut++;
    usleep(50000);
  }
  printf("\n");
}
void FLushProcess(double total,double current){

  char buffer[M];
  memset(buffer,0,sizeof(buffer));
  const char *lable = "|/-\\";
  int len = strlen(lable);
  static int cnt = 0;
  int num =(int)(current*100/total);
  double rate = current/total;
  for(int i = 0;i<num;i++)
  {
    buffer[i] = STYLE;
  }
  cnt%=len;
  printf("[%-100s][%.1f%%][%c]\r",buffer,rate*100,lable[cnt]);
  cnt++;
  fflush(stdout);
}
